const rank={
    0:"幼儿园",
    100:"小学",
    1000:"初中",
    4000:"高中",
    8000:"大学",
    10000:"硕士",
    12000:"博士",
    15000:"博士后",
    20000:"院士",
}
export var rankManager={
    //剩余多少学分可以升级
    getRankLeftCredit(credit){
        let _rank=0
        for(let key in rank){
            if(credit<key){
                _rank=key-credit
                break
            }
        }
        return _rank
    },
    //根据学分获取等级
    getRankByCredit(credit){
        let _rank=""
        for(let key in rank){
            if(credit>=key){
                _rank=rank[key]
            }
        }
        return _rank
    },
    //获取所在等级一共多少学分
    getCreditByRank(credit){
        let last=0;
        let next=0;
        for(let key in rank){
            if(credit>=key){
                last=key
            }
            else{
                next=key
                break
            }
        }
        return next-last
    }

}